package com.example.rrr_map;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class ResultActivity extends Activity {
	
	private TextView tvResult;
	private Button buttonCool;
	private double randNum;
	
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_result);
		
		tvResult = (TextView) findViewById(R.id.fightresult);
		randNum = Math.random();
		if(randNum<0.5) {
			tvResult.setText("YOU WON\nLEVEL UP");
		} else {
			tvResult.setText("YOU LOST");
		}
		buttonCool = (Button) findViewById(R.id.buttoncool);
		buttonCool.setOnClickListener(coolClickListener);

		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.result, menu);
		return true;
	}

	
	protected OnClickListener coolClickListener = new OnClickListener()
    {
		@Override
		public void onClick(View v) {
			
			Intent intent = new Intent(getApplicationContext(), MainActivity.class);
			startActivity(intent);
		}
    };
	
}
